//
//  MTQueryRedpackModel.swift
//  MT
//
//  Created by ooops on 2019/12/24.
//  Copyright © 2019 张强. All rights reserved.
//

import Foundation
import ObjectMapper

class MTQueryRedpackModel: Mappable {
    
    var code: Int?
    var message: String?
    var success: Bool?
    var timestamp: TimeInterval?
    var result: [MTQueryResultModel]?
    var page: MTQueryPageModel?
    var money: Int?
    /// 外部赋值 - 是否是发送红包记录
    var isSender: Bool? = false
    
    required init?(map: Map) {
        
    }
    
    open func mapping(map: Map) {
        result        <- map["result"]
        message       <- map["message"]
        success       <- map["success"]
        timestamp     <- map["timestamp"]
        code          <- map["code"]
        page          <- map["page"]
        money         <- map["money"]
    }
    
}

class MTQueryResultModel: Mappable {
    
    /// 红包总数量
    var count: Int?
    /// 发放日期
    var createTime: String?
    /// 总金额
    var money: Int?
    /// 用户昵称
    var nickname: String?
    /// 已领取数量
    var pullCount: Int?
    /// 类型 0人对人1平均2随机
    var redpacketType: Int?
    /// 红包状态，0未领完,1已领完，2已过期
    var state: Int?
    
    required init?(map: Map) {
        
    }
    
    open func mapping(map: Map) {
        count           <- map["count"]
        createTime      <- map["createTime"]
        money           <- map["money"]
        nickname        <- map["nickname"]
        pullCount       <- map["pullCount"]
        redpacketType   <- map["redpacketType"]
        state           <- map["state"]
    }
}

class MTQueryPageModel: Mappable {
    
    var curPage: Int?
    var pageSize: Int?
    var pages: Int?
    var total: Int?
    
    required init?(map: Map) {
        
    }
    
    open func mapping(map: Map) {
        curPage        <- map["curPage"]
        pageSize       <- map["pageSize"]
        pages       <- map["pages"]
        total     <- map["total"]
    }
}
